/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package 垃.圾;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

/**
 *
 * @author EnzoZhong
 */
public class AK47 extends Gun {

   /**
    *
    * @param target
    * @param port
    * @param bullet
    */
   public AK47 ( String target , int port , byte[] bullet ) {
      super( target , port , bullet );
   }

   /**
    *
    * @param target
    * @param bullet
    */
   public AK47 ( String target , byte[] bullet ) {
      super( target , bullet );
   }

   @Override
   public void run () {
      try {
         byte[] bullet = this.getBullet();
         DatagramSocket ds = new DatagramSocket();
         DatagramPacket dp = new DatagramPacket( bullet , bullet.length ,
				     InetAddress.getByName( this.getTarget() ) , this.getPort() );
         ds.send( dp );
      } catch ( IOException ex ) {
         System.out.println( "AK47 MISS " + this.getPort() +ex);
      }
   }
}
